from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response


def home(request):
    if request.method == 'GET':
        if request.user.is_authenticated():
            return render_to_response('home/home.html', {})
        else:
            return HttpResponseRedirect(reverse('login'))
    # else:
    #     return HttpResponseServerError(loader.render_to_string('500.html'), {})
    # there are default views like 'django.views.defaults.permission_denied' that can be returned
    # more here: https://docs.djangoproject.com/en/1.4/topics/http/urls/#error-handling
/#error-handling
